
# 字符串方法

# 1. 查找字符串
print("helloworldpythongojava".find("l"))       # 查不到的是返回的是-1
print("helloworldpythongojava".index("l"))      # 查不到报错

# print("helloworldpythongojava".find("kkk"))       # 查不到的是返回的是-1
# print("helloworldpythongojava".index("kkk"))      # 查不到报错

# 2. 判断开头或结尾
print("demoxxx.py".startswith("demo"))
print("demoxxx.py".endswith('.py'))

# 3. 连接字符串，分割字符串
base_url = "http://192.168.10.12"
login_path = '/auth/login'
print("".join([base_url,login_path]))
print(".".join(['demo','py']))

print("demo05_str_method.py".split('_'))

# 4. 替换字符串
a = "hello python"
b=a.replace('python','go')
print(a)
print(b)